﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        

        public Form1()
        {
            InitializeComponent();
        }

        private void OnTest(object sender, EventArgs e)
        {          
                String text = textBox1.Text;
                String[] A = text.Split(',');
                int[] B;
                int max = 0;
                int sum = 0;
                B = new int[A.Length];
                for (int i = 0; i < A.Length; i++)
                {
                    int b = 0;
                    int.TryParse(A[i], out b);
                    B[i] = b;
                }
                for (int i = 0; i < B.Length; i++)
                {
                    sum += B[i];
                    if (B[i] > max) max = B[i];
                }
                double avg = sum / B.Length;
                string Max = max.ToString();
                string Sum = sum.ToString();
                string Avg = avg.ToString();
                string output = "和为" + Sum + "最大为" + Sum + "平均为" + Avg;
                MessageBox.Show(output);
            
        }
    }
}
